
<h1><span class="yiyi-st" id="yiyi-12">numpy.fft.irfft</span></h1>
        <blockquote>
        <p>原文：<a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.irfft.html">https://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.irfft.html</a></p>
        <p>译者：<a href="https://github.com/wizardforcel">飞龙</a> <a href="http://usyiyi.cn/">UsyiyiCN</a></p>
        <p>校对：（虚位以待）</p>
        </blockquote>
    
<dl class="function">
<dt id="numpy.fft.irfft"><span class="yiyi-st" id="yiyi-13"> <code class="descclassname">numpy.fft.</code><code class="descname">irfft</code><span class="sig-paren">(</span><em>a</em>, <em>n=None</em>, <em>axis=-1</em>, <em>norm=None</em><span class="sig-paren">)</span><a class="reference external" href="http://github.com/numpy/numpy/blob/v1.11.3/numpy/fft/fftpack.py#L373-L459"><span class="viewcode-link">[source]</span></a></span></dt>
<dd><p><span class="yiyi-st" id="yiyi-14">计算实数输入的n点DFT的逆。</span></p>
<p><span class="yiyi-st" id="yiyi-15">该函数计算由<a class="reference internal" href="numpy.fft.rfft.html#numpy.fft.rfft" title="numpy.fft.rfft"><code class="xref py py-obj docutils literal"><span class="pre">rfft</span></code></a>计算的实数输入的一维<em>n</em>点离散傅里叶变换的逆。</span><span class="yiyi-st" id="yiyi-16">换句话说，<code class="docutils literal"><span class="pre">irfft（rfft（a），</span> <span class="pre">len（a））</span> <span class="pre">==</span> <span class="pre">a</span> </code>到数值精度。</span><span class="yiyi-st" id="yiyi-17">（见下面的注释，为什么<code class="docutils literal"><span class="pre">len(a)</span></code>在这里是必要的。）</span></p>
<p><span class="yiyi-st" id="yiyi-18">输入预期为由<a class="reference internal" href="numpy.fft.rfft.html#numpy.fft.rfft" title="numpy.fft.rfft"><code class="xref py py-obj docutils literal"><span class="pre">rfft</span></code></a>返回的形式，即实际的零频率项，后面是按照频率增加的顺序的复数正频率项。</span><span class="yiyi-st" id="yiyi-19">由于实数输入的离散傅里叶变换是厄米对称的，负频率项被认为是相应的正频率项的复共轭。</span></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name">
<col class="field-body">
<tbody valign="top">
<tr class="field-odd field"><th class="field-name"><span class="yiyi-st" id="yiyi-20">参数：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-21"><strong>a</strong>：array_like</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-22">输入数组。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-23"><strong>n</strong>：int，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-24">输出的变换轴的长度。</span><span class="yiyi-st" id="yiyi-25">对于<em class="xref py py-obj">n</em>输出点，需要<code class="docutils literal"><span class="pre">n//2+1</span></code>个输入点。</span><span class="yiyi-st" id="yiyi-26">如果输入长于此，则会裁剪。</span><span class="yiyi-st" id="yiyi-27">如果它比这短，用零填充。</span><span class="yiyi-st" id="yiyi-28">如果未给出<em class="xref py py-obj">n</em>，则根据沿<em class="xref py py-obj">轴</em>指定的轴的输入长度确定。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-29"><strong>axis</strong>：int，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-30">用于计算逆FFT的轴。</span><span class="yiyi-st" id="yiyi-31">如果未给出，则使用最后一个轴。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-32"><strong>norm</strong>：{None，“ortho”}，可选</span></p>
<blockquote>
<div><div class="versionadded">
<p><span class="yiyi-st" id="yiyi-33"><span class="versionmodified">版本1.10.0中的新功能。</span></span></p>
</div>
<p><span class="yiyi-st" id="yiyi-34">规范化模式（参见<a class="reference internal" href="../routines.fft.html#module-numpy.fft" title="numpy.fft"><code class="xref py py-obj docutils literal"><span class="pre">numpy.fft</span></code></a>）。</span><span class="yiyi-st" id="yiyi-35">默认值为None。</span></p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name"><span class="yiyi-st" id="yiyi-36">返回：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-37"><strong>out</strong>：ndarray</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-38">未指定沿<em class="xref py py-obj">轴</em>指示的轴变换的截断或零填充输入，如果<em class="xref py py-obj">轴</em>指定最后一个输入。</span><span class="yiyi-st" id="yiyi-39">变换轴的长度为<em class="xref py py-obj">n</em>，或者如果未给出<em class="xref py py-obj">n</em>，则<code class="docutils literal"><span class="pre">2*(m-1)</span></code>其中<code class="docutils literal"><span class="pre">m</span></code>是输入的变换轴的长度。</span><span class="yiyi-st" id="yiyi-40">要获得奇数个输出点，必须指定<em class="xref py py-obj">n</em>。</span></p>
</div></blockquote>
</td>
</tr>
<tr class="field-odd field"><th class="field-name"><span class="yiyi-st" id="yiyi-41">上升：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-42"><strong>IndexError</strong></span></p>
<blockquote class="last">
<div><p><span class="yiyi-st" id="yiyi-43">如果<em class="xref py py-obj">axis</em>大于<em class="xref py py-obj">a</em>的最后一个轴。</span></p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title"><span class="yiyi-st" id="yiyi-44">也可以看看</span></p>
<dl class="last docutils">
<dt><span class="yiyi-st" id="yiyi-45"><a class="reference internal" href="../routines.fft.html#module-numpy.fft" title="numpy.fft"><code class="xref py py-obj docutils literal"><span class="pre">numpy.fft</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-46">用于定义所使用的DFT和约定。</span></dd>
<dt><span class="yiyi-st" id="yiyi-47"><a class="reference internal" href="numpy.fft.rfft.html#numpy.fft.rfft" title="numpy.fft.rfft"><code class="xref py py-obj docutils literal"><span class="pre">rfft</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-48">实数输入的一维FFT，其中<a class="reference internal" href="#numpy.fft.irfft" title="numpy.fft.irfft"><code class="xref py py-obj docutils literal"><span class="pre">irfft</span></code></a>是反向的。</span></dd>
<dt><span class="yiyi-st" id="yiyi-49"><a class="reference internal" href="numpy.fft.fft.html#numpy.fft.fft" title="numpy.fft.fft"><code class="xref py py-obj docutils literal"><span class="pre">fft</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-50">一维FFT。</span></dd>
<dt><span class="yiyi-st" id="yiyi-51"><a class="reference internal" href="numpy.fft.irfft2.html#numpy.fft.irfft2" title="numpy.fft.irfft2"><code class="xref py py-obj docutils literal"><span class="pre">irfft2</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-52">实数输入的二维FFT的逆。</span></dd>
<dt><span class="yiyi-st" id="yiyi-53"><a class="reference internal" href="numpy.fft.irfftn.html#numpy.fft.irfftn" title="numpy.fft.irfftn"><code class="xref py py-obj docutils literal"><span class="pre">irfftn</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-54">实数输入的<em>n</em>维FFT的逆。</span></dd>
</dl>
</div>
<p class="rubric"><span class="yiyi-st" id="yiyi-55">笔记</span></p>
<p><span class="yiyi-st" id="yiyi-56">返回<em class="xref py py-obj">a</em>的实数值<em class="xref py py-obj">n</em>点离散傅里叶逆变换，其中<em class="xref py py-obj">a</em>包含厄米对称序列的非负频率项。</span><span class="yiyi-st" id="yiyi-57"><em class="xref py py-obj">n</em>是结果的长度，而不是输入。</span></p>
<p><span class="yiyi-st" id="yiyi-58">如果您指定<em class="xref py py-obj">n</em>使得<em class="xref py py-obj">a</em>必须填零或截断，则将以高频添加/删除额外/除去的值。</span><span class="yiyi-st" id="yiyi-59">因此，可以通过以下方式通过傅立叶内插将一系列重新采样到<em class="xref py py-obj">m</em>点：<code class="docutils literal"><span class="pre">a_resamp</span> <span class="pre">=</span> <span class="pre">irfft（rfft </span> <span class="pre">m）</span></code>。</span></p>
<p class="rubric"><span class="yiyi-st" id="yiyi-60">例子</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">fft</span><span class="o">.</span><span class="n">ifft</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="n">j</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="n">j</span><span class="p">])</span>
<span class="go">array([ 0.+0.j,  1.+0.j,  0.+0.j,  0.+0.j])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">fft</span><span class="o">.</span><span class="n">irfft</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="n">j</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">])</span>
<span class="go">array([ 0.,  1.,  0.,  0.])</span>
</pre></div>
</div>
<p><span class="yiyi-st" id="yiyi-61">注意到普通<a class="reference internal" href="numpy.fft.ifft.html#numpy.fft.ifft" title="numpy.fft.ifft"><code class="xref py py-obj docutils literal"><span class="pre">ifft</span></code></a>的输入中的最后一项是第二项的复共轭，并且输出在每个地方具有零虚部。</span><span class="yiyi-st" id="yiyi-62">当调用<a class="reference internal" href="#numpy.fft.irfft" title="numpy.fft.irfft"><code class="xref py py-obj docutils literal"><span class="pre">irfft</span></code></a>时，未指定负频率，并且输出数组是纯实数。</span></p>
</dd></dl>
